//! 运行server模块重构测试的脚本

use std::process::Command;

fn main() {
    println!("开始运行server模块重构测试...");
    
    // 运行单独的server模块测试
    let server_tests = [
        "enhanced_traits_test",
        "service_manager_test", 
        "component_factory_test",
        "event_publisher_test",
        "config_manager_test",
        "refactored_servers_test",
    ];
    
    for test in &server_tests {
        println!("\n=== 运行 {} ===", test);
        
        let output = Command::new("cargo")
            .args(&["test", "--lib", test, "--", "--test-threads=1"])
            .output()
            .expect("Failed to execute cargo test");
            
        if output.status.success() {
            println!("✅ {} 测试通过", test);
            println!("{}", String::from_utf8_lossy(&output.stdout));
        } else {
            println!("❌ {} 测试失败", test);
            println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
            println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
        }
    }
}